package com.design.twords.database;

import org.litepal.LitePal;
import org.litepal.annotation.Column;
import org.litepal.crud.LitePalSupport;

import java.util.List;

/**
 * Create by Alen
 * Time:  13:45
 */
public class Word_all extends LitePalSupport {

    // id
    private long wordId;

    // 单词
    private String word;

    //类型
    private String wordBook;

    // 英国音标
    private String ukPhone;

    // 美国音标
    private String usPhone;

    //巧计
    private String remMethod;

    // 自定义备注
    private String remark;

    //是否收藏
    //默认没有
    @Column(defaultValue = "0")
    private int isCollected;

    //关联关系
    //翻译
    private List<Translation_all> transList;
    //句子
    private List<Sentence_all> sentencesList;
    //同根词
    private List<RelWord_all> relWordList;
    //短语
    private List<Phrase_all> phrasesList;


    @Override
    public String toString() {
        return "Word_all{" +
                "wordId=" + wordId +
                ", word='" + word + '\'' +
                ", ukPhone='" + ukPhone + '\'' +
                ", usPhone='" + usPhone + '\'' +
                ", remark='" + remark + '\'' +
                '}';
    }
    public Word_all(){}

    public long getWordId() {
        return wordId;
    }

    @Override
    public boolean save() {
        return super.save();
    }

    public void setWordId(long id) {
        this.wordId = id;
    }

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word;
    }

    public String getUkPhone() {
        return ukPhone;
    }

    public void setUkPhone(String ukPhone) {
        this.ukPhone = ukPhone;
    }

    public String getUsPhone() {
        return usPhone;
    }

    public void setUsPhone(String usPhone) {
        this.usPhone = usPhone;
    }

    public String getRemMethod() {
        return remMethod;
    }

    public void setRemMethod(String remMethod) {
        this.remMethod = remMethod;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getWordBook() {
        return wordBook;
    }

    public void setWordBook(String wordBook) {
        this.wordBook = wordBook;
    }

    public int getIsCollected() {
        return isCollected;
    }

    public void setIsCollected(int isCollected) {
        this.isCollected = isCollected;
    }

    public List<Translation_all> getTransList() {
        return LitePal.where("wordId = ? and wordBook = ?", String.valueOf(wordId), wordBook).find(Translation_all.class);
    }

    public List<Sentence_all> getSentencesList() {
        return LitePal.where("wordId = ? and wordBook = ?", String.valueOf(wordId), wordBook).find(Sentence_all.class);
    }

    public List<RelWord_all> getRelWordList() {
        return LitePal.where("wordId = ? and wordBook = ?", String.valueOf(wordId), wordBook).find(RelWord_all.class);
    }

    public List<Phrase_all> getPhrasesList() {
        return LitePal.where("wordId = ? and wordBook = ?", String.valueOf(wordId), wordBook).find(Phrase_all.class);
    }


}
